import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 全局css
import './assets/css/globl.css'
//引入树状表格组件
import TableTree from 'vue-table-with-tree-grid'
//引入富文本编辑器组件
import VueQuillEditor from 'vue-quill-editor'
// 引入富文本编辑器样式
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme



import axios from 'axios'
// 设置请求根路径
axios.defaults.baseURL = "http://timemeetyou.com:8889/api/private/v1/"
// 设置请求拦截器
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')

  return config
})
Vue.prototype.$http = axios
Vue.config.productionTip = false
// 注册vue-table-with-tree-grid组件
Vue.component('TableTree', TableTree)
//注册富文本编辑器组件
Vue.use(VueQuillEditor)
//定义全局的时间过滤器
Vue.filter('dateFormat', function (date) {
  const dt = new Date(date)
  const Year = dt.getFullYear()
  const Month = (dt.getMonth() + 1 + '').padStart(2, '0')
  const Day = (dt.getDay() + '').padStart(2, '0')
  const Hour = (dt.getHours() + '').padStart(2, '0')
  const Minute = (dt.getMinutes() + '').padStart(2, '0')
  const Seconds = (dt.getSeconds() + '').padStart(2, '0')
  return `${Year}-${Month}-${Day} ${Hour}:${Minute}:${Seconds}`


})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
